#pragma once
#include "ProbabilityModel.h"
#include "BitBuffer.h"
#include "ContextTree.h"

class ArithmeticEncoder
{
	public:
		ArithmeticEncoder(ProbabilityModel* model);
		ArithmeticEncoder(ContextTree* ctwTree, int modelSize, int blockSize);
		virtual ~ArithmeticEncoder(void);
		BitBuffer encodeString(const char* string, unsigned long long* symbolsEncoded, int size = 1024);

	private:
		void encodeSymbol(unsigned int symbol, BitBuffer& buffer);

		ProbabilityModel* model;
		ContextTree* ctwTree;
		unsigned int lowerBound;
		unsigned int upperBound;
		unsigned int underflow;
		int modelSize;
		int blockSize;
		int symbolSize;
};
